<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>调整响应顺序</title>
    <style>
        .box1 {
            width: 600px;
            height: 600px;
            background-color: red;
        }

        .box2 {
            width: 400px;
            height: 400px;
            background-color: yellow;
        }

        .box3 {
            width: 200px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="box1" @click="box1Clicked">
        <!--事件的响应默认情况从内向外处理-->
        <!--.self 修饰只响应自身相关的事件-->
        <div class="box2" @click.stop.self="box2Clicked">
            <div class="box3" @click="box3Clicked"></div>
        </div>
    </div>
</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                function box1Clicked() {
                    console.log("点击了 外部区域");
                }

                function box2Clicked() {
                    console.log("点击了 中间区域");
                }

                function box3Clicked() {
                    console.log("点击了 内部区域");
                }

                return {
                    box1Clicked, box2Clicked, box3Clicked
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>